package com.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.service.CommonService;
import com.utils.R;

@RestController
public class CommonController{
	@Autowired
	private CommonService commonService;


	@IgnoreAuth
	@RequestMapping("/option/{tableName}/{columnName}")
	public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
		Map<String, Object> params = new HashMap<>();
		params.put("table", tableName);
		params.put("column", columnName);

		List<String> data = commonService.getOption(params);
		return R.ok().put("data", data);
	}

}
